<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        /*
            every 类似于 &&
                一假则假，全部真，结果才是真
            some  类似于 ||
                一真则真，全部假，结果才是假
        */

        // const list1 = [ 10, 20, 30, 40 ]

        // const res1 = list1.every(v => {
        //     console.log(v)
        //     return v <= 20
        // })

        // console.log(res1)


        // const list2 = [ 10, 20, 30, 40 ]
        // const res2 = list2.some(v => {
        //     console.log(v)
        //     return v <= 20
        // })
        // console.log(res2)


        // every可以用在那种找都需要满足的情况
        const list = [10, 22, 31, 40]
        const res = list.every( v => {
            return v % 2 === 0
        } )

        console.log(res) // false

    
        // some可以用在只要有的情况
        // 例如：我要找这个数组里是否有偶数
        const res2 = list.some(v => v % 2 === 0)
        console.log(res2)

    </script>
</body>
</html>